package com.wuxiaofan.ware.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.ware.entity.PurchaseDetail;
import com.wuxiaofan.ware.entity.custom.PurchaseDetailCustom;
import com.wuxiaofan.ware.mapper.PurchaseDetailMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.ware.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class PurchaseDetailService {
    @Autowired
    private PurchaseDetailMapper wmsPurchaseDetailMapper;
    @Resource
    private Idgenerator idgenerator;
    public PurchaseDetail findById(String id){
        return wmsPurchaseDetailMapper.selectById(id);
    }

    public PurchaseDetailCustom findCountByMap(Map paraMap){
        return wmsPurchaseDetailMapper.findCountByMap(paraMap);
    }

    public PurchaseDetailCustom findGroupByMap(Map paraMap){
        return wmsPurchaseDetailMapper.findGroupByMap(paraMap);
    }

    public List<PurchaseDetailCustom> findByMap(Map paraMap){
        return wmsPurchaseDetailMapper.findByMap(paraMap);
    }

    public Page<PurchaseDetailCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(wmsPurchaseDetailMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        wmsPurchaseDetailMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        wmsPurchaseDetailMapper.deleteById(id);
    }

    public PurchaseDetail save(PurchaseDetail wmsPurchaseDetail){
        wmsPurchaseDetail.setId(idgenerator.getId());
        wmsPurchaseDetailMapper.insert(wmsPurchaseDetail);
        return wmsPurchaseDetail;
    }

}
